package thread.java20221219;

public class Demo21 {

    public static void main(String[] args) {
        Object object = new Object();
        Thread t1 = new Thread(){
            @Override
            public void run() {
                synchronized (object){
                    while (true){

                    }
                }
            }
        };

        Thread t2 = new Thread(){
            @Override
            public void run() {
                synchronized (object){
                    while (true){

                    }
                }
            }
        };
        t1.start();
        t2.start();
    }
}
